package com.web.js;

import com.database.objects.*;
import com.metrics.objects.Metric;

public class OptionsJS {

	private static final String SEPARATOR = "%%";

	private static final String SEPARATOR_2 = "##";

	public String[] getOptionsByRepository(String repository) {
		String[] options = new String[3];
		options[0] = getMetrics(repository);
		options[1] = getTypes(repository);
		options[2] = getStatus(repository);
		return options;
	}

	private String getMetrics(String repository) {
		String options = "";
		for (Metric metric : Project.getMetrics(repository)) {
			options += metric.toString() + SEPARATOR_2 + metric.getText() + SEPARATOR;
		}
		return options;
	}

	private String getTypes(String repository) {
		String options = "";
		for (Type type : Project.getTypes(repository)) {
			options += type.toString() + SEPARATOR_2 + type.getName() + SEPARATOR;
		}
		return options;
	}

	private String getStatus(String repository) {
		String options = "";
		for (Status status : Project.getStatus(repository)) {
			options += status.toString() + SEPARATOR_2 + status.toString() + SEPARATOR;
		}
		return options;
	}

}
